﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using System.Xml.Serialization;
using Glue_Data.ViewModels;
using Glue_FrameWork.ViewModels.Param;
using Microsoft.Expression.Interactivity.Core;
using MvvmLib;

namespace MathFlowLib.FeatureJudge
{
    [Serializable]
    //[XmlInclude(typeof(Vm_MathFlow_Line_FeatureStd))]
    public abstract class Vm_MathFlow_FeatureStd : GParam, ISelfConfig
    {
        /// <summary>
        /// 判级标准
        /// </summary>
        public ObservableCollection<Vm_Feature_Std> FeatureStdCollection
        {
            get { return _FeatureStdCollection; }
            set
            {
                if (_FeatureStdCollection != value)
                {
                    _FeatureStdCollection = value;
                    OnPropertyChanged("FeatureStdCollection");
                }
            }
        }
        private ObservableCollection<Vm_Feature_Std> _FeatureStdCollection
            = new ObservableCollection<Vm_Feature_Std>();

        /// <summary>
        /// 特征名称列表数组
        /// </summary>
        [XmlIgnore]
        public string[] FeatureNameArr
        {
            get { return this.GetFeatureNames(); }
        }

        /// <summary>
        /// 名称
        /// </summary>
        public string Name
        {
            get { return _Name; }
            set
            {
                if (_Name != value)
                {
                    _Name = value;
                    OnPropertyChanged("Name");
                }
            }
        }
        private string _Name = "特征标准";

        #region Commands

        /// <summary>
        /// 自定义命令
        /// </summary>
        [XmlIgnore]
        public ICommand Command_SelfConfig
        {
            get { return _Command_SelfConfig; }
            set
            {
                if (_Command_SelfConfig != value)
                {
                    _Command_SelfConfig = value;
                }
            }
        }
        [NonSerialized]
        private ICommand _Command_SelfConfig;

        #endregion


        #region Methods

        /// <summary>
        /// ctor
        /// </summary>
        public Vm_MathFlow_FeatureStd()
        {
            Init();
        }

        /// <summary>
        /// 初始化
        /// </summary>
        public void Init()
        {
            this.Command_SelfConfig = new ActionCommand(this.SelfConfig);
        }

        /// <summary>
        /// 自定义设置方法
        /// </summary>
        private void SelfConfig()
        {
            Win_MathFlow_FeatureStd win = new Win_MathFlow_FeatureStd(this);
            win.ShowDialog();
        }

        /// <summary>
        /// 获取特征名称数组
        /// </summary>
        /// <returns>特征名称数组</returns>
        public abstract string[] GetFeatureNames();

        #endregion


    }
}
